package org.example.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

@Repository
public class FlowDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    // 插入流水
    public int insertFlow(long fromCardId, long toCardId, int flowType, BigDecimal amount) {
        String sql = "INSERT INTO flow(from_card_id,to_card_id,flow_type,amount) VALUES(?,?,?,?)";
        return jdbcTemplate.update(sql, fromCardId, toCardId, flowType, amount);
    }
}